home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / util / cli / SmartPrompt.lha / SmartPrompt / SmartPrompt.doc < prev    next >
Encoding:
Text File  |  1998-09-26  |  9.5 KB  |  241 lines

  1.  
  2.               SmartPrompt v1.0 Smart shell Prompt enhancement
  3.                             Documentation File
  4.                            September 26th, 1998
  5.  
  6.          Copyright (C) 1998 by Adrian Zurek. All rights reserved.
  7.  
  8.  
  9.  
  10.     BORING LEGAL STUFF
  11.     ==================
  12.  
  13.  SmartPrompt  software and  this documentation are written and  copyrighted
  14.  (C) 1998 by Adrian Zurek.
  15.  
  16.  This program is  free software;  you can redistribute it  and/or modify it
  17.  under the terms of the GNU General Public License as published by the Free
  18.  Software Foundation;  either version 2 of the License, or (at your option)
  19.  any later version.
  20.  
  21.  This program  is distributed in  the hope  that  it  will  be useful,  but
  22.  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  23.  or  FITNESS FOR A PARTICULAR PURPOSE.  See  the GNU General Public License
  24.  for more details.
  25.  
  26.  You should  have  received a copy of  the GNU General Public License along
  27.  with this program; see the file COPYING.
  28.  If not, write to the Free Software Foundation,
  29.  675 Mass Ave, Cambridge, MA 02139, USA.
  30.  
  31.  There is no warranty,  implied or whatever.  You use this software at your
  32.  own risk, no matter what purpose you put it to.  You didn't pay for it, so
  33.  don't expect magic.
  34.  
  35.  
  36.     CONTACT
  37.     =======
  38.  
  39.  You may contact me via snail-mail:
  40.  
  41.     Adrian Zurek
  42.     ul. Mieszczanska 5/55
  43.     93-322 Lodz
  44.     Poland
  45.  
  46.  or via e-mail:
  47.  
  48.     adek@plukwa.pdi.net
  49.  or eventually
  50.     adek@rast.lodz.pdi.net
  51.  
  52.  If You are familiar with IRC then  You can catch me (nick aDEk)  on IRCNET
  53.  on channel #amigapl (polish language) or #amigaexotic (English).
  54.  
  55.  Hmmm... Maybe You should know that I'm a member of the sEASONS group.  Plz
  56.  check
  57.      http://listen.to/floydmon
  58.  to get more info about us :)
  59.  
  60.  
  61.     HOW TO GET IT
  62.     =============
  63.  
  64.  You can get it from me of course (see above) or via anonymous FTP at:
  65.     ftp://plukwa.pdi.net/PL-A-Net/util/shell
  66.  BTW: from here You can get another program from me:
  67.     AScreen (archives as_xx-xx.lha)
  68.  or hopefully from
  69.     Aminet/util/shell (but I wouldn't be so sure about that :))
  70.  
  71.  
  72.     INTRODUCTION
  73.     ============
  74.  
  75.     Do  You use  sometimes UNIX?  If the answer is  yes  then  You probably
  76.  noticed that  *IX shells are very well organized, and their prompts can be
  77.  very easily changed to what You want by changing only environment variable
  78.  $PROMPT.  On AmigaOS it  isn't so easy:  You have to change  it by running
  79.  command "Prompt" with a suitable argument.  That was good  some years ago,
  80.  but now this command is too old and have too many limits.
  81.  And here comes SmartPrompt.  It is better than a real prompt  and has many
  82.  features:
  83.  
  84.  - Multiuser and AmiTCP support;
  85.  
  86.  - conditional strings placed  in prompt when current user is a root or not
  87.    a root;
  88.  
  89.  - *IX path styles or Amiga conventional;
  90.  
  91.  - two types of displaying paths;
  92.  
  93.  - it isn't a hack! friendly for OS!;
  94.  
  95.  - it's small  (hmmm... could be smaller though ;)  and pure so can be made
  96.    resident!;
  97.  
  98.  - it's free!;
  99.  
  100.  - written by me! (I know that is the best feature for You ;)))
  101.  
  102.  There are many more features but I want to keep You in curiosity... :)
  103.  
  104.  
  105.     REQUIREMENTS
  106.     ============
  107.  
  108.     You need Kickstart 2.04 (V37), about 8kB free memory to run this proggy
  109.  and some more for  shell consoles  and of course my AScreen (just kidding,
  110.  but it would be very nice to use it ;))
  111.  You will also need a hard disk or a floppy disk drive with disks,  monitor
  112.  and a keyboard (I think that there won't be any problems with this but who
  113.  knows... :))
  114.  And that's all! Ready to go...
  115.  
  116.  
  117.     USING SmartPrompt
  118.     =================
  119.  
  120.     The  first thing  to do is  to copy  SmartPrompt  to  c:  directory  or
  121.  somewhere else  where You like it , make it  readable  and executable  for
  122.  everyone  (on Multiuser)  and set a "p" protection  mode which  means that
  123.  it can be made resident. Of course inserting line "Resident C:SmartPrompt"
  124.  is a definitely a good thing to do.
  125.  The next  important  step  is to  insert  a line  "Prompt *`SmartPrompt*`"
  126.  somewhere in Your shell-startup. This tells Prompt to execute it each time
  127.  the shell displays a new prompt.
  128.  Hmmm... before  this line You  should set  a environment  variable  called
  129.  $PROMPT - it can be a global or a local variable. In this variable will be
  130.  a string which tells SmartPrompt how to display Your prompt.
  131.  So insert a line something like this: set SPROMPT "%p{ap00}"
  132.  Hmmm... Now it's a good time to explain You all format codes that
  133.  SmartPrompt recognizes:
  134.  
  135.  %u   - current  userid  (root, nobody etc.)  works only  on  Multiuser  or
  136.         AmiTCP! on other systems it displays 'nobody'.
  137.  %h   - hostname - Your  computer  name.  It gets this from variable  named
  138.         $hostname.
  139.  
  140.  %t   - current time in format hh:mm:ss for example 12:23:55.
  141.  %d   - date in format dd-mmm-yy for example 26-Sep-98.
  142.  %w   - weekday, for example Thursday.
  143.  
  144.  %%   - displays '%' character.
  145.  %q   - displays '"' character.
  146.  %b   - displays '{' character.
  147.  %B   - displays '}' character.
  148.  
  149.  %R{} - this is a conditional command.  The string inside "{"  "}" brackets
  150.         will be inserted in prompt string if the current user is root.
  151.         Without Multiuser and AmiTCP it simply displays nothing.
  152.  %r{} - same as above but displays string if the current user isn't a root.
  153.         Without Multiuser and AmiTCP it displays specified string.
  154.  NOTE:  in brackets  can be all format codes except  %R{} and %r{} to avoid
  155.         recursion!
  156.  
  157.  %p{} - this tells SmartPrompt to display current path. In "{" "}" brackets
  158.         are additional format codes:
  159.     a - display current path in Amiga style e.g. "Work:tmp" - default.
  160.     x - display current path in *IX style e.g. "/Work/tmp".
  161.     d - replace volume names as  "Work:"  or  "Ram Disk:" with device names
  162.         "DH0:", "RAM:".  Note that if this isn't specified SmartPrompt will
  163.         still replace volume names that has  a <SPACE> character  inside it
  164.         with device name, so "Ram Disk:" will be always replaced by "RAM:".
  165.   pxx - format code "p" tells SmartPrompt how to display current path.  The
  166.         number after a "p" character is very important and HAS to be in two
  167.         digits e.g. "02". Only xx last components of path will be displayed
  168.         so if the path is "Work:my/gfx/tmp" and the number is "02" You will
  169.         see only "gfx/tmp" string.  If the number is greater than the total
  170.         number of components in the path it will show everything.
  171.         "00" means: always show everything.
  172.   Pxx - second path style.  The difference between above style  and this is
  173.         that now  the "xx"  number  specifies max  prompt  length.  If  the
  174.         original prompt length is  greater than that You  gave,  it will be
  175.         shortened to its abbreviation.  Like above, number has to be in two
  176.         digits.
  177.         Example: a path like "Work:my/gfx/tmp/outcoming"  will be shortened
  178.         to "Work:///outcoming" if it exceeds the desired prompt length.
  179.         As You can see here is a name of volume,  one slash for each subdir
  180.         and  a full name of  the last component.  Please note that the last
  181.         path  component  will  be  always  displayed even  if the resulting
  182.         string is longer than Your limit.
  183.  
  184.  And that's all folks (really simple isn't it? :))
  185.  No, it isn't simple so I think now it's a good time for
  186.  
  187.     EXAMPLES
  188.     ========
  189.  
  190.     Lets say You want to have a *IX style prompt like this:
  191.     "[adek@rast:0 archives]$ "
  192.  it's very simple with SmartPrompt to do this! see:
  193.     set SPROMPT "[%u@%h:$ascreen %p{xp01}]%R[#]%r{$} "
  194.  hehe... can You still understand this?  Note that  "$ascreen" is the local
  195.  variable from AScreen which consists actual window number.  As You can see
  196.  You may insert environment  variables into its string.  And here is a good
  197.  time to tell  You that now the main limit  for this program that it cannot
  198.  get  an actual  process number.  Why?  Because SmartPrompt is  executed in
  199.  a new process, so its number is different than the shell number. But it is
  200.  still  to be displayed:  just insert  "$process"  string somewhere in Your
  201.  $SPROMPT variable.
  202.  
  203.  Second example: You can make a prompt colored! Just look at this line:
  204.     set SPROMPT "[%R{*E[32m}%u%R{*E[0m}@%h:$ascreen %p{xp01}]%R[#]%r{$} "
  205.  it's very similar  to the previous  example  but  displays  userid  in red
  206.  color (on my system it is red ;)). Of course "*E[32m" and  "*E[0m" are the
  207.  standard console codes.
  208.  
  209.  Ufff... Maybe it isn't enough for You to know everything but try it!  Just
  210.  insert various combinations of the format codes and see the results!
  211.  
  212.  NOTE: if You have Multiuser or/and AmiTCP installed, but its corresponding
  213.        libraries (multiuser.library/usergroup.library) aren't started, than
  214.        SmartPrompt won't know that they are installed!
  215.        But  this  shouldn't be  a problem for  You because  usually  before
  216.        a shell prompt displays You login to the system.
  217.  
  218.  
  219.     TODO
  220.     ====
  221.  
  222.     Not many as this should be a very small, quick and handy program:
  223.  
  224.  - make him able to get a current process number;
  225.  
  226.  - support for recognizing and displaying homedirs and assigns;
  227.  
  228.  
  229.     EPILOG
  230.     ======
  231.  
  232.     And at the end  I'd like to thanks  all the people  who want to be with
  233.  Amiga, for good and for the worst (It seems that now are the worst :().
  234.  And finally here are special, individual greetings:
  235.  
  236.  Robert "rEkiN" Redziak - encouraged me  to do this  and showed  me similar
  237.                           programs.
  238.  Matthias Bethke        - for his  PromptPath from  which I got an idea for
  239.                           the second style path.
  240.  all sEASONS members    - for being great m8s and for much fun!
  241.